﻿using System.Windows.Controls;
using YKXiangQi.Common;

namespace YKXiangQi.Controls
{
    public class AutoScrollTextBox : TextBox
    {
        public AutoScrollTextBox()
        {
            //var ctxMenu = new ContextMenu();
            //ctxMenu.Items.Add(new MenuItem()
            //                      {
            //                          Header = "Clear",
            //                          Command = new RelayCommand(Clear)
            //                      });

            //this.ContextMenu = ctxMenu;
            this.TextChanged += OnTextChanged;
        }

        protected void OnTextChanged(object sender, TextChangedEventArgs e)
        {
            this.ScrollToEnd();
        }

        //protected void Clear(object param)
        //{
        //    lock (obj)
        //    {
        //        this.Text = string.Empty;
        //    }
        //}
    }
}
